package edu.sctu.practice.class02.hujie.cgs.assign05.three;

/**
 * Created by hp on 2015/12/17.
 */
public class Sort2Or31 {
    double max1, max2, max3;

    Sort2Or31() {
        max1 = -1;
        max2 = -1;
        max3 = -1;
    }

    void sort(double i, double j) {
        double s;
        max1 = i;
        max2 = j;
        if (max1 < max2) {
            s = max1;
            max1 = max2;
            max2 = s;
        }
    }

    void sort(double i, double j, double k) {
        double s;
        max1 = i;
        max2 = j;
        max3 = k;
        if (max1 < max2) {
            s = max1;
            max1 = max2;
            max2 = s;
        }
        if (max1 < max3) {
            s = max1;
            max1 = max3;
            max3 = s;
        }
        if (max2 < max3) {
            s = max2;
            max2 = max3;
            max3 = s;
        }
    }
}
